#ifndef _SHADER_PROGRAM_H_
#define _SHADER_PROGRAM_H_



#include <glad/glad.h>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>

#include <glm_no_warnings.h>

#include "applogger.h"

class ShaderProgram
{
public:
    unsigned int ID;
    // constructor generates the shader 
    // ------------------------------------------------------------------------
    ShaderProgram() =default;
    ShaderProgram(const char* vertexPath, const char* fragmentPath);
    
    void compileProgram(const char* vertexPath, const char* fragmentPath);

    ~ShaderProgram() =default;

    // activate the shader
    // ------------------------------------------------------------------------
    void useProgram() { glUseProgram(ID); }

    
    // utility uniform functions
    void setBool(const std::string &name, bool value) const;
    void setInt(const std::string &name, int value) const;
    void setFloat(const std::string &name, float value) const;
    void setVec2(const std::string &name, glm::vec2 &value) const;
    void setVec3(const std::string &name, glm::vec3 &value) const;
    void setVec3(const std::string &name, float value0, float value1, float value2) const;
    void setVec4(const std::string &name, glm::vec4 &value) const;
    void setMat4(const std::string &name, glm::mat4 value) const;


private:
    void checkCompileErrors(unsigned int shader, std::string type);

};

#endif
